home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_pas / xport11.zip / XPORT.DOC < prev    next >
Text File  |  1996-04-01  |  21KB  |  547 lines

  1.  
  2.                               ──══ Galaxy 5 ══──
  3.                     Xport Unit for UrDoor Programmers v1.1
  4.                       Copyright (c) 1996 Thomas J. Smith
  5.  
  6.  
  7.  
  8.                                    CONTENTS
  9.      ────────────────────────────────────────────────────────────────────
  10.       Whats New?.......................................................1
  11.       Introduction.....................................................2
  12.       Requirements.....................................................3
  13.       About This Unit..................................................4
  14.       Getting Started..................................................5
  15.       Running Your Xport...............................................6
  16.       Procedure & Function Library.....................................7
  17.      ────────────────────────────────────────────────────────────────────
  18.  
  19.  
  20.  
  21.                                   WHATS NEW?                           1
  22.      ────────────────────────────────────────────────────────────────────
  23.       New in v1.1 is that it should work now! <G> I had added a command
  24.       that does not work with the distributed versions of UrDoor. It was
  25.       a command that I made global within the UrDoor unit (by editing
  26.       the source code), and that procedure I made global is not global
  27.       in the normal versions of UrDoor. Sorry guys/gals! ;>
  28.      ────────────────────────────────────────────────────────────────────
  29.  
  30.  
  31.                                 INTRODUCTION                           2
  32.      ────────────────────────────────────────────────────────────────────
  33.       The Xport unit is freeware, and remains copyrighted (c) 1996 by
  34.       Thomas J. Smith. I ask for no royalties from any Xports created
  35.       using this unit. UrDoor, and the FileLock unit are copyrighted
  36.       property of their respective authors. The UrDoor unit is NOT
  37.       included with this archive, however the freeware FileLock unit is
  38.       included. Refer to UrDoor's documentation for information on
  39.       registering the UrDoor unit with the author, Kenneth Bledsoe.
  40.      ────────────────────────────────────────────────────────────────────
  41.       The Xport unit is used in conjunction with the UrDoor door writing
  42.       kit by Kenneth Bledsoe. It will allow UrDoor programmers to write
  43.       Xports quickly and easily! The Xport unit handles all of the drop
  44.       file reading routines, reading & writing the players record, fully
  45.       supports multi node systems by using the FILELOCK.PAS unit, and
  46.       contains many procedures and functions that can be used in your
  47.       Xports!
  48.      ────────────────────────────────────────────────────────────────────
  49.  
  50.  
  51.                                  REQUIREMENTS                          3
  52.      ────────────────────────────────────────────────────────────────────
  53.       The Xport unit was written to work with UrDoor for Turbo Pascal 7
  54.       so I am not sure if it will work with TP 6.
  55.      ────────────────────────────────────────────────────────────────────
  56.       Before you can use the Xport unit, you must have URDOOR.TPU,
  57.       XPORT.TPU, FILELOCK.TPU, & NETFILEP.TPU in your units directory,
  58.       or in the directory you will be compiling your Xport(s) in.
  59.      ────────────────────────────────────────────────────────────────────
  60.       And of course you will need Galaxy 5 to test your Xport with! ;>
  61.      ────────────────────────────────────────────────────────────────────
  62.  
  63.  
  64.                                 ABOUT THIS UNIT                        4
  65.      ────────────────────────────────────────────────────────────────────
  66.       The Xport unit does everything that an Xport is supposed to do.
  67.       Reads the DROPFILE.* file for all of the info required (instead of
  68.       reading a BBS drop file), reads the players info from the
  69.       PLAYERS.DAT file, and reads the info of the current planet that
  70.       the caller is on when he/she enters the Xport.
  71.      ────────────────────────────────────────────────────────────────────
  72.       The Xport unit also writes the players info to the PLAYERS.DAT
  73.       file after your Xport exits, so you NEVER have to access the
  74.       PLAYERS.DAT file, the Xport Unit does it for you! ;> All you have
  75.       to do is make any desired changes to the players record using the
  76.       "Player" variable. For example, to give the player 1,000 krills
  77.       for some reason, just use, "Inc (Player.Money, 1000);" (without
  78.       the quotes of course). You need not record the changes via the
  79.       PLAYERS.DAT file, as the Xport unit does that upon exit of your
  80.       Xport every time, even thru a call to "Halt" via your Xport,
  81.       and/or any run-time errors that may occur!
  82.      ────────────────────────────────────────────────────────────────────
  83.       The Xport unit also makes use of the same file locking routines
  84.       which G5 uses, via the FileLock unit.
  85.      ────────────────────────────────────────────────────────────────────
  86.  
  87.  
  88.                                 GETTING STARTED                        5
  89.      ────────────────────────────────────────────────────────────────────
  90.       1) Compile the FILELOCK.PAS unit using the "Build All Units"
  91.          option either by selecting "Compile|Build" from within the
  92.          IDE, or by using the /B option for the command line compiler.
  93.  
  94.       2) Move all *.TPU files to your units directory. Usually TP\UNITS
  95.  
  96.       3) In your Xports uses statement, include the following units,
  97.          UrDoor, Xport, FileLock. For example,
  98.          Uses UrDoor, Xport, FileLock;
  99.  
  100.       4) As the VERY first statement of your Xport, name your Xport
  101.          with the UrDoor variable, DoorName (DoorName := 'My Xport';).
  102.  
  103.       5) The next statement MUST call the "Init_Xport" procedure
  104.          (Init_Xport;). This procedure initializes the Xport unit, and
  105.          reads in all of the info of the player using the Xport,
  106.          including his/her current planet.
  107.      ────────────────────────────────────────────────────────────────────
  108.       The only exception to step 4, is if you install your own exit
  109.       procedure, then put the statements that set up your exit procedure
  110.       as the very first statements in your program. Please note that the
  111.       Xport unit installs its own exit procedure that writes changes to
  112.       the players file in case of a crash or unexpected halt of the
  113.       Xport, but this need not concern you, as it will not interfere
  114.       with your own exit procedures.
  115.      ────────────────────────────────────────────────────────────────────
  116.  
  117.  
  118.                               RUNNING YOUR XPORT                       6
  119.      ────────────────────────────────────────────────────────────────────
  120.       Here is the REQUIRED command line to run your Xport that you must
  121.       put in the XPORTS.DAT file located in Galaxy 5's home directory,
  122.  
  123.       D:\GALAXY5\MYXPORT\MYXPORT.EXE ~UD~ TRUE ~UB~ ~UF~ ~UL~ ~UC~ ~UN~
  124.  
  125.       replacing MYXPORT with the directory location of your Xport, and
  126.       MYXPORT.EXE with the file name of your Xport. All of the G5 codes
  127.       (~UD~, etc.) MUST be in uppercase!
  128.      ────────────────────────────────────────────────────────────────────
  129.       Here are explanations of each command used on that command line,
  130.  
  131.       ~UD~ = Shows the Xport where to find the DROPFILE.* file to read
  132.              (the * will be the node number). The Xport unit
  133.              automatically reads the drop file for you, no need for you
  134.              to add a routine to do it yourself! ;>
  135.       TRUE = Set this to TRUE or FALSE for "Keep a log of errors?"
  136.       ~UB~ = Passes the baud rate of the caller.
  137.       ~UF~ = First name of the caller.
  138.       ~UL~ = Last name of the caller.
  139.       ~UC~ = COM port number this caller is on (if local, then this will
  140.              read 0).
  141.       ~UN~ = Node number this caller is on.
  142.      ────────────────────────────────────────────────────────────────────
  143.       When adding your Xport to the XPORTS.DAT file, the first line
  144.       should be the name of your Xport (the way it will be shown to
  145.       callers from the Xports Menu), and the second line should be the
  146.       command line described above. Here is an example,
  147.  
  148.       A Cool Xport!
  149.       D:\GALAXY5\MYXPORT\MYXPORT.EXE ~UD~ TRUE ~UB~ ~UF~ ~UL~ ~UC~ ~UN~
  150.      ────────────────────────────────────────────────────────────────────
  151.  
  152.  
  153.                          PROCEDURE & FUNCTION LIBRARY                  7
  154.      ────────────────────────────────────────────────────────────────────
  155.       This section lists all of the variables, procedures, & functions
  156.       available to you via the Xport unit.
  157.      ────────────────────────────────────────────────────────────────────
  158.  
  159.                                      VARIABLES
  160.      --------------------------------------------------------------------
  161.       Every one of these variables will already hold a value after you
  162.       call the Init_Xport procedure except for the Enemy records. If you
  163.       wish to read info on an enemy, you must do this yourself.
  164.      --------------------------------------------------------------------
  165.  
  166.       Player : Player_Info;
  167.      ------------------------
  168.       The Player variable is a record variable  containing all of the
  169.       players info. Refer to the file G5_STRUC.PAS for a run down of all
  170.       of the player record fields that you can manipulate via your
  171.       Xport.
  172.  
  173.  
  174.       PlayerFile : File Of Player_Info;
  175.      -----------------------------------
  176.       This refers to the PLAYERS.DAT file located in the subdirectory
  177.       DATA located under the Galaxy 5 home directory. You do not have to
  178.       do anything with this file, as when you call the "WritePlayer"
  179.       function, it will write the players record for you, reflecting any
  180.       changes you may have made.
  181.  
  182.  
  183.       Planet : Planet_Info;
  184.      -----------------------
  185.       The planet records variable. Holds info about each of the 5
  186.       planets in the galaxy.
  187.  
  188.  
  189.       PlanetFile : File Of Planet_Info;
  190.      -----------------------------------
  191.       Refers to the PLANETS.DAT file also located in the DATA
  192.       subdirectory under the Galaxy 5 home directory.
  193.  
  194.  
  195.       Mate : Mate_Info;
  196.      -------------------
  197.       The "Inn Mates" records variable. Contains info on each of the
  198.       mates at each inn that players can flirt with.
  199.  
  200.  
  201.       MateFile : File Of Mate_Info;
  202.      -------------------------------
  203.       Refers to the G5_MATES.DAT file located in the DATA subdirectory.
  204.  
  205.  
  206.       Enemy : Enemy_Info;
  207.      ---------------------
  208.       Record variable on the enemies that players fight in the
  209.       warfields.
  210.  
  211.  
  212.       EnemyFile : File Of Enemy_Info;
  213.      ---------------------------------
  214.       Refers to the ENEMIES.DAT file in the DATA subdirectory. Holds all
  215.       enemy info.
  216.  
  217.  
  218.       W_Droid : Array [1..14] Of String[15];
  219.      ----------------------------------------
  220.       Contains the names of each warrior droid for each level.
  221.  
  222.  
  223.       SpaceShip, WeaponName, ArmourName : Array [1..10] Of String[20];
  224.      ------------------------------------------------------------------
  225.       These all contain the names of their respective items in an array.
  226.  
  227.  
  228.       UserFirst, UserLast : String[25];
  229.      -----------------------------------
  230.       Contains the first and last name of the user respectively.
  231.  
  232.  
  233.       BBSName : String[25];
  234.      -----------------------
  235.       The name of the BBS the Xport is being run on.
  236.  
  237.  
  238.       IRQ : Byte;
  239.      -------------
  240.       IRQ number the caller is on. If 0, then a fossil driver is being
  241.       used.
  242.  
  243.  
  244.       LogErrors : Boolean;
  245.      ----------------------
  246.       Is Log Errors set to true?
  247.  
  248.  
  249.       XP_Local : Boolean;
  250.      ---------------------
  251.       Is the Xport being run locally?
  252.  
  253.  
  254.       COM : Byte;
  255.      -------------
  256.       COM port number the caller is on. If 0, then Xport is being run
  257.       locally.
  258.  
  259.  
  260.       Baud : Integer;
  261.      -----------------
  262.       The callers connected baud rate.
  263.  
  264.  
  265.       Caller_From : String[25];
  266.      ---------------------------
  267.       Where the caller is calling from (as grabbed from the BBS drop
  268.       file via the UrDoor unit).
  269.  
  270.  
  271.       ANSI : Boolean;
  272.      -----------------
  273.       Set to true if caller has ANSI and/or RIP enabled, else false.
  274.  
  275.  
  276.       RIP : Boolean;
  277.      ----------------
  278.       Set to true if caller is calling from a RIP compatible terminal,
  279.       else false. If both ANSI and RIP are false, then caller is calling
  280.       using an ASCII terminal.
  281.  
  282.  
  283.       Sec_Level : String[25];
  284.      -------------------------
  285.       Callers security level on the BBS.
  286.  
  287.  
  288.       Xport_Dir : String;
  289.      ---------------------
  290.       This variable contains the full path to your Xports directory,
  291.       with NO trailing backslash, or file name of your Xport. Example,
  292.       D:\DOORS\G5\MY_XPORT
  293.  
  294.  
  295.       G5_Dir : String;
  296.      ------------------
  297.       Full path of the home Galaxy 5 directory with NO trailing
  298.       backslash. Example, D:\DOORS\G5
  299.  
  300.  
  301.       NodeNumber : String[3];
  302.      -------------------------
  303.       Node number the player is on.
  304.  
  305.  
  306.       PlayerSex : String[6];
  307.      ------------------------
  308.       The players gender, MALE or FEMALE.
  309.  
  310.  
  311.       PlayerHandle : String[20];
  312.      ----------------------------
  313.       The players handle in Galaxy 5.
  314.  
  315.       CleanMode : Boolean;
  316.      ----------------------
  317.       Holds true if the SysOps has "Allow Getting Laid?" set to NO, else
  318.       reads false.
  319.      ────────────────────────────────────────────────────────────────────
  320.  
  321.                            PROCEDURES & FUNCTIONS
  322.      --------------------------------------------------------------------
  323.  
  324.       Function G5YesNo (Default : Char) : Char;
  325.      -------------------------------------------
  326.       Displays a yes no prompt like, [Yes/no], or [yes/No]. The one that
  327.       will be capitalized will be the one that is set as the "Default"
  328.       in the parameter passed. This function will only accept the Y key,
  329.       the N key, or ENTER (which will default to the "Default"
  330.       character). Returns either Y or N.
  331.  
  332.       Example,
  333.               Var
  334.                  Ch : Char;
  335.  
  336.               Ch := G5YesNo ('Y');
  337.  
  338.               This one will default to Yes if the ENTER key is pressed.
  339.  
  340.  
  341.       Function G5ReadKey (Default : Char) : Char;
  342.      ---------------------------------------------
  343.       Displays nothing. Returns the uppercase equivelant of the key
  344.       pressed. If ENTER is pressed, then the character returned will be
  345.       the same as that passed as the "Default" parameter.
  346.  
  347.       Example,
  348.               Var
  349.                  Ch : Char;
  350.  
  351.               Repeat
  352.                     Ch := G5Readkey('Q');
  353.               Until Ch In ['1','2','3','Q'];
  354.  
  355.               This example will return Q if the ENTER key is pressed.
  356.  
  357.  
  358.       Procedure WriteBar (Color : String);
  359.      --------------------------------------
  360.       Displays a "Galaxy 5 Style" bar at the current cursor position.
  361.       Color is passed as a G5 color code.
  362.  
  363.       Example,
  364.               WriteBar('~07~');
  365.  
  366.               This example will write a grey colored bar.
  367.  
  368.  
  369.       Procedure G5Enter;
  370.      --------------------
  371.       Displays, ──══ Press Enter ══── centered on the last line of the
  372.       screen if ANSI is true, else it will be shown on the next line
  373.       when called. Only accepts the ENTER key.
  374.  
  375.       Example,
  376.               G5Enter;
  377.  
  378.  
  379.       Procedure G5Pause (Lines : Integer; Fancy : Boolean);
  380.      -------------------------------------------------------
  381.       Displays the <PAUSE> prompt and waits for a key to be pressed.
  382.       Lines is the number of blank lines to write to the screen BEFORE
  383.       the <PAUSE> prompt is shown. If Fancy is set to true, then the
  384.       <PAUSE> prompt will be "drawn" from left to right, and after a key
  385.       has been pressed, it will "erase" from right to left. If Fancy is
  386.       set to false, it will simply show the <PAUSE> prompt, and quickly
  387.       erase it after a key has been pressed.
  388.  
  389.       Example,
  390.               G5Pause(1, True);
  391.  
  392.               This will write one blank line to the screen before
  393.               displaying the <PAUSE> prompt, and will use the "fancy"
  394.               version of the prompt.
  395.  
  396.  
  397.       Procedure ReadPlanet (Number : Byte);
  398.      ---------------------------------------
  399.       Reads in the planet info of the planet number passed to it. The
  400.       number passed can be 1 through 5. Any higher or lower will show an
  401.       "I/O Error."
  402.  
  403.       Example,
  404.               ReadPlanet(1);
  405.  
  406.               This will read in the info on the first planet which you
  407.               can refer to with the "Planet.Variable" record variable.
  408.  
  409.  
  410.       Procedure View_Stats;
  411.      -----------------------
  412.       Shows the player his/her stats exactly as it is shown in Galaxy 5.
  413.  
  414.       Example,
  415.               View_Stats;
  416.  
  417.  
  418.       Procedure ReadPlayer (Number : Integer);
  419.      ------------------------------------------
  420.       Reads in the player info of player record number, Number. *NOTE*,
  421.       this procedure really should NEVER be called, as the record of the
  422.       player who is playing will be replaced with the new info! If you
  423.       need to read the info on another player, use the "ReadPlayerTemp"
  424.       procedure.
  425.  
  426.       Example,
  427.               ReadPlayer (5);
  428.  
  429.               This will read in the record of the player who has record
  430.               number 5 in the PLAYERS.DAT file.
  431.  
  432.  
  433.       ReadPlayerTemp (Number : Integer);
  434.      ------------------------------------
  435.       Same as "ReadPlayer," but reads a temporary record into the
  436.       "Player_Temp" record variable.
  437.  
  438.       Example,
  439.               ReadPlayerTmp (0);
  440.  
  441.               This will read the first player in the PLAYERS.DAT file.
  442.  
  443.  
  444.       Procedure WritePlayer;
  445.      ------------------------
  446.       Writes the current players record to the PLAYERS.DAT file.
  447.  
  448.       Example,
  449.               WritePlayer;
  450.  
  451.  
  452.       Procedure Read_Enemy (EnemyNum : Integer);
  453.      --------------------------------------------
  454.       Reads the enemys info located at file position EnemyNum in the
  455.       ENEMIES.DAT file. Can then be referred to using the
  456.       "Enemy.Variable" variables.
  457.  
  458.       Example,
  459.               Read_Enemy (10);
  460.  
  461.               This will read the 10th enemy record into the "Enemy"
  462.               record variable.
  463.  
  464.  
  465.       Procedure Read_Mate (Which : ShortInt);
  466.      -----------------------------------------
  467.       Reads in the mate info of "Which" number. "Which" can be 1 through
  468.       5.
  469.  
  470.       Example,
  471.               Read_Mate (4);
  472.  
  473.               Will read in the info of the mates on planet number 4.
  474.  
  475.  
  476.       Procedure ReadItems (WhichItems : Byte);
  477.      ------------------------------------------
  478.       This procedure reads in the array of the item number selected in
  479.       "WhichItems." 1 will read in the Ship names, 2 will read in the
  480.       Weapon names, and 3 will read in the Armour names. This is all
  481.       done automatically upon your Xports startup, and should not have
  482.       to be called.
  483.  
  484.       Example,
  485.               ReadItems (1);
  486.  
  487.               This will read in the Ship names into the array,
  488.               SpaceShip : Array [1..10] Of String[20];
  489.  
  490.  
  491.       Procedure G5Write (S : String);
  492.      ---------------------------------
  493.       Writes the string contained in S to the screen. The string to be
  494.       written can contain any G5 codes available to you, and they will
  495.       be shown correctly. This procedure does NOT add a CR/LF to the end
  496.       of the string!
  497.  
  498.       Example,
  499.               G5Write ('~03~Press ~0B~ENTER ~03~To Continue...');
  500.  
  501.               This will write "Press ENTER To Continue..." (without the
  502.               quotes), to the screen. 'Press' & 'To Continue...' would
  503.               be in cyan, and 'ENTER' would be in bright cyan. If the
  504.               caller does not have an ANSI terminal, then the codes are
  505.               simply stripped.
  506.  
  507.  
  508.       Procedure G5Writeln (S : String);
  509.      -----------------------------------
  510.       Same as G5Write, except that it sends a carriage return/line feed
  511.       at the end of the string.
  512.  
  513.       Example,
  514.               G5Writeln ('~03~You Suck!');
  515.  
  516.  
  517.       Procedure FileError (Number : Byte);
  518.      --------------------------------------
  519.       Shows the caller a message that looks like,
  520.       "** BLAST IT! **  File is missing!" then calls a <PAUSE> prompt.
  521.       Can be used when a required file is not found. The "Number"
  522.       variable tells the procedure how many blank lines to write to the
  523.       screen BEFORE the "BLAST IT" message is shown.
  524.  
  525.       Example,
  526.               FileError (1);
  527.  
  528.               This will write one blank line to the screen, then display
  529.               the "BLAST IT" message, etc.
  530.  
  531.  
  532.       Procedure IoError (Number : Byte);
  533.      ------------------------------------
  534.       Exactly the same as the FileError procedure, except this one tells
  535.       the caller there was an I/O error reading a file.
  536.  
  537.       Example,
  538.               IoError (1);
  539.  
  540.               Writes one blank line to the screen, then shows the caller
  541.               the message, "*** I/O ERROR ***" then calls a <PAUSE>
  542.               prompt.
  543.  
  544.  
  545.  
  546.    -THE END-
  547.